fix(cli): correct warnIfDeprecatedRegion message — --region is still honored, not ignored - #822
Merged
Merged
Conversation
warnIfDeprecatedRegion and the hidden deprecatedRegionOption help text both claimed --region "has no effect" on non-bootstrap commands, but every non-bootstrap command consumes options.region as the highest-precedence region source (options.region || AWS_REGION || 'us-east-1') for the SDK clients, the applyRoleArnIfSet STS hop, and (deploy / destroy / import / export / orphan) the AWS_REGION env var inherited by the synth subprocess. The warning and the code contradicted each other. Investigation confirmed --region IS legitimately honored everywhere (option B in the issue), so the fix is purely in the warning text + the option description -- no command implementation (deploy.ts etc.) is touched, keeping the change out of the integ-broad merge-gate scope with zero behavior-change risk. The warning now says the flag is deprecated but still honored and steers users toward AWS_REGION / their AWS profile without falsely claiming the flag did nothing. Docs corrected to match: docs/cli-reference.md, docs/troubleshooting.md, and the --region bullet in .claude/rules/cli-internals.md. Tests: tests/unit/cli/options.test.ts updates the message assertion and adds checks that neither the warning nor the option description contains "no effect" and that both mention the flag is "still honored"; the three command tests asserting the old wording (list / publish-assets / state-list) are updated to the new message. Closes #818
github-actions Bot
pushed a commit
that referenced
this pull request
Jun 13, 2026
## [0.220.2](v0.220.1...v0.220.2) (2026-06-13) ### Bug Fixes * **cli:** correct warnIfDeprecatedRegion message — --region is still honored, not ignored ([#822](#822)) ([4ec8230](4ec8230))
|
🎉 This PR is included in version 0.220.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
warnIfDeprecatedRegionwarned that--regionis "deprecated for this command and has no effect" on non-bootstrap commands — but the flag IS honored everywhere: every command resolves region asoptions.region || process.env.AWS_REGION || 'us-east-1', feeding the provisioning/state-bucket SDK client region, theapplyRoleArnIfSetSTS hop, and (on deploy/destroy/import/export/orphan)process.env.AWS_REGIONinjected into the CDK synth subprocess. So--regionis the highest-precedence region source, directly contradicting the "no effect" message.Fix (option B — correct the warning, keep honoring the flag)
Changing behavior to actually ignore
--regionwould silently break scripts that rely on it, so the least-surprising fix keeps the flag honored and corrects the message: now reads "deprecated and will be removed in a future release; still honored for now (it overrides AWS_REGION / your AWS profile); prefer AWS_REGION / your AWS profile." The option help text + JSDoc are updated to match.No behavior change — purely the warning message + option description + docs.
deploy.tsand all command files are untouched (no integ-gate scope affected).Test plan
tests/unit/cli/options.test.ts: warning message updated; added assertions that neither the warning nor the description says "no effect" and both say "still honored".list/publish-assets/state-list) asserting the old wording.docs/cli-reference.md,docs/troubleshooting.md,.claude/rules/cli-internals.md.Closes #818